import time
from public.action import *
from public.business import *
from public.testData import *
from public.tools import *

testCase="DBshop013_商品分类分类编辑"
firefox=openBrowser(urlAdmin)
DBshopLoginAdmin(firefox)
DBshopEnterMenu3(firefox,"商品管理","管理分类","商品分类")
firefox.find_element_by_xpath("//button").click()
firefox.find_element_by_id("class_name").send_keys("商品分类测试")
firefox.find_element_by_xpath("//button[text()='保存分类']").click()
time.sleep(3)
firefox.find_element_by_xpath("//td[contains(.,'商品分类测试')]/following-sibling::td[4]/a[2]"    ).click()
firefox.find_element_by_id("class_sort").clear()
firefox.find_element_by_id("class_sort").send_keys("4")
firefox.find_element_by_xpath("(//button[contains(text(),'保存分类')])[2]").click()
num=firefox.find_element_by_xpath("//td[contains(.,'商品分类测试')]/following-sibling::td[2]/input").get_property("value")
# print(num)
try:
    if num=='4':
        writeLog("%s 测试通过"%testCase)
except:
    writeLog("%s 测试失败" % testCase)
    getPhoto(firefox)






# firefox.find_element_by_partial_link_text("添加分类").click()
# firefox.find_element_by_id("class_name").send_keys("商品分类测试")
# firefox.find_element_by_id("class_sort").clear()
# firefox.find_element_by_id("class_sort").send_keys("1")
# firefox.find_element_by_xpath("//button").click()

